<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html >
<html>

<head>

<jsp:include page="/page/include/_head.jsp"/>
	
<title>个人博客</title>
	
</head>



<body>

	<div class="container">
		<div style="height: 10px;"></div>
		<div class="nav-user">
			<c:if test="${empty user}" var="flag">
				<a href="/user/login">登陆</a>/<a href="/user/register">注册</a>
			</c:if>
			<c:if test="${!flag}">
				欢迎【${user.nickname}】的到来！
			</c:if>
		</div>
		
		<blockquote>
			<h3>个人博客</h3>
			<small>再NB的技术也经不住你SB似的坚持。</small>
		</blockquote>
		
		<ul class="nav nav-tabs" >
			<li  title="首页"><a onclick="changeIndex('首页');toHref('/index');" href="javascript:void(0)">首页</a></li>
			<c:forEach items="${types}" var="type">
				<li  title="${type.name}"><a onclick=" changeIndex('${type.name}');change(${type.id})" href="javascript:void(0)">${type.name}</a></li>
			</c:forEach>
			<li  title="发布"><a onclick="changeIndex('发布');toHref('/blog/publish');"  href="javascript:void(0)">发布</a></li>
		</ul>
	</div>
	<div style="height: 20px;"></div>
	<div id="msg"  class="container">
		
		<img alt="" src="/images/load.gif" class="img-responsive"/>
		
	</div>
	<div id="content">
		
	
	</div>
	
<script type="text/javascript">
var home ={
	
	"menuFlag" : false,
	"href" :""
};



function changeIndex(name){
	if(home.menuFlag){
		return;
	} 
	$("li[title]").removeAttr("class")
	$("li[title="+name+"]").attr("class","active");
}

function change(typeId){
	
	toHref("/blog/list");
	
	$.get("/blog/getList/"+typeId+"/1",function(result){
		$("#list").html(result);
		
	});
}

function toHref(href){
	if(home.menuFlag){
		return;
	}
	if(href==home.href){
		return;
	}
	home.menuFlag=true;
	$("#msg").css("display","block");
	$("#content").css("display","none");
	$.get(href,function(result){
		$("#content").html(result);
		$("#content").fadeIn(2000);
		home.menuFlag=false;
		$("#msg").css("display","none");
		home.href = href;
	});
	menuType = 0;
}

changeIndex("首页");
toHref("/index");


</script>
</body>
</html>
